home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / DllSys_Files / LINAXON / BKLINEAR.C next >
Encoding:
C/C++ Source or Header  |  2002-03-08  |  1.4 KB  |  47 lines

  1. // Dynamic link library implementation of NeuroSolutions BackLinearAxon component 
  2.  
  3. #include "NSDLL.h"
  4.  
  5. /********************************/
  6. /* Backpropagation of component */
  7.  
  8. __declspec(dllexport) void performBackLinearAxon(
  9.     DLLData *instance,    // Pointer to instance data (may be NULL)
  10.     DLLData *dualInstance,    // Pointer to the forward axons instance data (may be NULL)
  11.     NSFloat    *data,         // Pointer to the layer of processing elements (PEs)
  12.     int     rows,        // Number of rows of PEs in the layer
  13.     int     cols,        // Number of columns of PEs in the layer
  14.     NSFloat    *error,     // Pointer to the sensitivity vector
  15.     NSFloat    *gradient,     // Pointer to the bias gradient vector
  16.     NSFloat    beta        // Slope gain scalar, same for all PEs
  17.     )
  18.     
  19. {
  20.     int i, length=rows*cols;
  21.  
  22.     for (i=0; i<length; i++) {
  23.         error[i] *= beta;
  24.         if (gradient)
  25.             gradient[i] += error[i];
  26.     } 
  27. }
  28.  
  29. /******************************************/
  30. /* Management of instance data (OPTIONAL) */
  31. /*
  32. __declspec(dllexport) DLLData *allocBackLinearAxon(
  33.     DLLData    *oldInstance,    // Pointer to the last instance if reallocating
  34.     DLLData    *dualInstance,    // Pointer to forward axonÆs instance data (may be NULL)
  35.     int     rows,        // Number of rows of PEs in the layer
  36.     int     cols        // Number of columns of PEs in the layer
  37.     )
  38. {
  39.     DLLData *instance = allocDLLInstance(oldInstance);
  40.     return instance;
  41. }
  42.  
  43. __declspec(dllexport) void freeBackLinearAxon(DLLData *instance)
  44. {
  45.     freeDLLInstance(instance);
  46. }
  47. */